#include "udp.h"

#include "stdio.h"
#include "string.h"
#include "unistd.h"
#include "stdlib.h"

int UpdateDiff(diff_t *diff)
{
	diff->tow++;
	diff->numBds++;
	diff->numGps++;
	diff->PRN[0]++;
	diff->dDO[0]++;
	return 0;
}

int main(int argc, char const *argv[])
{
	char tChar[20]="127.0.0.1";

	if (argc>1) strcpy(tChar,argv[1]);
		else printf("no ip add\n");

    diff_t *diff=malloc(sizeof(diff_t)+MAX_LEN_ONCE);
    memset((void *)diff,0,sizeof(diff_t)+MAX_LEN_ONCE);

    printf("%d\n",sizeof(diff_t)+MAX_LEN_ONCE);

	UdpStationInit(tChar);
    while(1)
    {
        UpdateDiff(diff);
        //sendto(station_sock_fd,&diff,MAX_LEN_ONCE,0,(struct sockaddr *)&addr_station_server,server_len);
        UdpStationSend(diff);
        usleep(1000000);
        //PrintDiff(diff);
    }
	free(diff);
	return 0;
}

